From 00cc8736f10098dedf6b856b9ad8bd0094211263 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Thu, 18 Feb 2021 11:56:08 -0500 Subject: vbe support, truecolor window manager pixbufs --- src/user/include/libfont/fonts.h | 5 ++++- src/user/include/libterm/command.h | 4 ++-- src/user/include/libterm/terminal.h | 2 +- src/user/include/pland/syscall.h | 13 ++++++++++--- src/user/include/popups/info.h | 6 +++--- src/user/include/popups/popup.h | 2 +- 6 files changed, 21 insertions(+), 11 deletions(-) (limited to 'src/user/include') diff --git a/src/user/include/libfont/fonts.h b/src/user/include/libfont/fonts.h index b66659f..f7ed3e1 100644 --- a/src/user/include/libfont/fonts.h +++ b/src/user/include/libfont/fonts.h @@ -1,6 +1,8 @@ #ifndef LIBFONT_FONTS_H #define LIBFONT_FONTS_H +#include + #include #include @@ -16,6 +18,7 @@ struct font_info { struct font_info *get_font(const char *name); -void put_char(const struct font_info *font, char ch, uint8_t *pb_ptr, uint32_t pb_pitch, uint8_t bg, uint8_t fg); +//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); #endif \ No newline at end of file diff --git a/src/user/include/libterm/command.h b/src/user/include/libterm/command.h index 7587306..ca9e00d 100644 --- a/src/user/include/libterm/command.h +++ b/src/user/include/libterm/command.h @@ -37,8 +37,8 @@ struct terminal_command { uint32_t x; } as_coords; struct { - uint8_t fg; - uint8_t bg; + _pixel_t fg; + _pixel_t bg; } as_color; char as_char; uint32_t as_uint; diff --git a/src/user/include/libterm/terminal.h b/src/user/include/libterm/terminal.h index 19bd517..40536e0 100644 --- a/src/user/include/libterm/terminal.h +++ b/src/user/include/libterm/terminal.h @@ -12,7 +12,7 @@ void term_get_dimensions(uint32_t *width, uint32_t *height); void term_paint(); void term_clear(); -void term_set_color(uint8_t fg, uint8_t bg); +void term_set_color(_pixel_t fg, _pixel_t bg); void term_set_cursor(uint32_t new_y, uint32_t new_x); void term_cursor_left(); diff --git a/src/user/include/pland/syscall.h b/src/user/include/pland/syscall.h index fd0b416..9518d09 100644 --- a/src/user/include/pland/syscall.h +++ b/src/user/include/pland/syscall.h @@ -18,6 +18,13 @@ typedef struct __attribute__ ((packed)) { uint8_t pad[23]; } _dir_info_entry_t; +typedef struct __attribute__ ((packed)) { + uint8_t r; + uint8_t g; + uint8_t b; + uint8_t pad; +} _pixel_t; + enum _scn { _SCN_OPEN_FILE, _SCN_CLOSE_FILE, @@ -177,7 +184,7 @@ static inline uint32_t _count_of_dir(uint8_t drive_number, const char *path) { return _sc2(_SCN_COUNT_OF_DIR, drive_number, (uint32_t)path); } -static inline _window_handle_t _new_window(uint16_t width, uint16_t height, void *pixel_buffer) { +static inline _window_handle_t _new_window(uint16_t width, uint16_t height, _pixel_t *pixel_buffer) { return (_window_handle_t)_sc3(_SCN_NEW_WINDOW, width, height, (uint32_t)pixel_buffer); } @@ -185,11 +192,11 @@ static inline void _delete_window(_window_handle_t window) { _sc1(_SCN_DELETE_WINDOW, (uint32_t)window); } -static inline void _resize_window(_window_handle_t window, uint16_t width, uint16_t height, const void *pixel_buffer) { +static inline void _resize_window(_window_handle_t window, uint16_t width, uint16_t height, const _pixel_t *pixel_buffer) { _sc4(_SCN_RESIZE_WINDOW, (uint32_t)window, width, height, (uint32_t)pixel_buffer); } -static inline void _reassign_pixbuf(_window_handle_t window, const void *pixel_buffer) { +static inline void _reassign_pixbuf(_window_handle_t window, const _pixel_t *pixel_buffer) { _sc2(_SCN_REASSIGN_PIXBUF, (uint32_t)window, (uint32_t)pixel_buffer); } diff --git a/src/user/include/popups/info.h b/src/user/include/popups/info.h index 2c4e83f..36d557a 100644 --- a/src/user/include/popups/info.h +++ b/src/user/include/popups/info.h @@ -7,8 +7,8 @@ #include -void info_popup(struct popup *into, const char *text, uint8_t fg, uint8_t bg); -void info_popupf(struct popup *into, const char *text, uint8_t fg, uint8_t bg, ...); -void info_popupf_v(struct popup *into, const char *text, uint8_t fg, uint8_t bg, va_list args); +void info_popup(struct popup *into, const char *text, _pixel_t fg, _pixel_t bg); +void info_popupf(struct popup *into, const char *text, _pixel_t fg, _pixel_t bg, ...); +void info_popupf_v(struct popup *into, const char *text, _pixel_t fg, _pixel_t bg, va_list args); #endif \ No newline at end of file diff --git a/src/user/include/popups/popup.h b/src/user/include/popups/popup.h index 9a39997..cf4315b 100644 --- a/src/user/include/popups/popup.h +++ b/src/user/include/popups/popup.h @@ -5,7 +5,7 @@ struct popup { _window_handle_t handle; - uint8_t *pixbuf; + _pixel_t *pixbuf; bool has_quit; struct key_packet quit_as; -- cgit v1.2.3