Changeset 424cd43 in mainline for uspace/srv/console/screenbuffer.h
- Timestamp:
- 2009-06-03T18:39:12Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8dc12ac
- Parents:
- b0a91acb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/console/screenbuffer.h
rb0a91acb r424cd43 38 38 #include <stdint.h> 39 39 #include <sys/types.h> 40 #include <bool.h> 40 41 41 #define DEFAULT_FOREGROUND 0x0 /**< default console foreground color */42 #define DEFAULT_BACKGROUND 0xf0f0f0 /**< default console background color */42 #define DEFAULT_FOREGROUND 0x0 /**< default console foreground color */ 43 #define DEFAULT_BACKGROUND 0xf0f0f0 /**< default console background color */ 43 44 44 45 typedef struct { … … 73 74 typedef struct { 74 75 wchar_t character; /**< Character itself */ 75 attrs_t attrs; /**< Character `sattributes */76 attrs_t attrs; /**< Character attributes */ 76 77 } keyfield_t; 77 78 … … 79 80 */ 80 81 typedef struct { 81 keyfield_t *buffer; 82 83 unsigned int size_x;/**< Number of columns */84 unsigned int size_y;/**< Number of rows */82 keyfield_t *buffer; /**< Screen content - characters and 83 their attributes (used as a circular buffer) */ 84 size_t size_x; /**< Number of columns */ 85 size_t size_y; /**< Number of rows */ 85 86 86 87 /** Coordinates of last printed character for determining cursor position */ 87 unsigned int position_x;88 unsigned int position_y;88 size_t position_x; 89 size_t position_y; 89 90 90 attrs_t attrs; 91 unsigned int top_line;/**< Points to buffer[][] line that will92 93 unsigned charis_cursor_visible; /**< Cursor state - default is visible */91 attrs_t attrs; /**< Current attributes. */ 92 size_t top_line; /**< Points to buffer[][] line that will 93 be printed at screen as the first line */ 94 bool is_cursor_visible; /**< Cursor state - default is visible */ 94 95 } screenbuffer_t; 95 96 … … 106 107 * 107 108 */ 108 static inline keyfield_t *get_field_at(screenbuffer_t *scr, unsigned int x, unsigned int y)109 static inline keyfield_t *get_field_at(screenbuffer_t *scr, size_t x, size_t y) 109 110 { 110 111 return scr->buffer + x + ((y + scr->top_line) % scr->size_y) * scr->size_x; … … 139 140 140 141 void screenbuffer_putchar(screenbuffer_t *scr, wchar_t c); 141 screenbuffer_t *screenbuffer_init(screenbuffer_t *scr, int size_x, int size_y);142 screenbuffer_t *screenbuffer_init(screenbuffer_t *scr, size_t size_x, size_t size_y); 142 143 143 144 void screenbuffer_clear(screenbuffer_t *scr); 144 void screenbuffer_clear_line(screenbuffer_t *scr, unsigned int line);145 void screenbuffer_clear_line(screenbuffer_t *scr, size_t line); 145 146 void screenbuffer_copy_buffer(screenbuffer_t *scr, keyfield_t *dest); 146 void screenbuffer_goto(screenbuffer_t *scr, unsigned int x, unsigned int y);147 void screenbuffer_set_style(screenbuffer_t *scr, int style);148 void screenbuffer_set_color(screenbuffer_t *scr, u nsigned int fg_color,149 u nsigned int bg_color, unsigned int attr);150 void screenbuffer_set_rgb_color(screenbuffer_t *scr, u nsigned int fg_color,151 u nsigned int bg_color);147 void screenbuffer_goto(screenbuffer_t *scr, size_t x, size_t y); 148 void screenbuffer_set_style(screenbuffer_t *scr, uint8_t style); 149 void screenbuffer_set_color(screenbuffer_t *scr, uint8_t fg_color, 150 uint8_t bg_color, uint8_t attr); 151 void screenbuffer_set_rgb_color(screenbuffer_t *scr, uint32_t fg_color, 152 uint32_t bg_color); 152 153 153 154 #endif
Note:
See TracChangeset
for help on using the changeset viewer.