Changeset 04803bf in mainline for uspace/lib/c/include/io/screenbuffer.h
- Timestamp:
- 2011-03-21T22:00:17Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 143932e3
- Parents:
- b50b5af2 (diff), 7308e84 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 moved
-
uspace/lib/c/include/io/screenbuffer.h (moved) (moved from uspace/srv/console/screenbuffer.h ) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/io/screenbuffer.h
rb50b5af2 r04803bf 33 33 */ 34 34 35 #ifndef SCREENBUFFER_H__36 #define SCREENBUFFER_H__35 #ifndef LIBC_SCREENBUFFER_H__ 36 #define LIBC_SCREENBUFFER_H__ 37 37 38 38 #include <stdint.h> … … 40 40 #include <bool.h> 41 41 42 #define DEFAULT_FOREGROUND 0x0 /**< default console foreground color */ 43 #define DEFAULT_BACKGROUND 0xf0f0f0 /**< default console background color */ 42 typedef enum { 43 at_style, 44 at_idx, 45 at_rgb 46 } attr_type_t; 44 47 45 48 typedef struct { … … 58 61 } attr_rgb_t; 59 62 63 typedef union { 64 attr_style_t s; 65 attr_idx_t i; 66 attr_rgb_t r; 67 } attr_val_t; 68 60 69 typedef struct { 61 enum { 62 at_style, 63 at_idx, 64 at_rgb 65 } t; 66 union { 67 attr_style_t s; 68 attr_idx_t i; 69 attr_rgb_t r; 70 } a; 70 attr_type_t t; 71 attr_val_t a; 71 72 } attrs_t; 72 73 … … 82 83 keyfield_t *buffer; /**< Screen content - characters and 83 84 their attributes (used as a circular buffer) */ 84 s ize_t size_x;/**< Number of columns */85 s ize_t size_y;/**< Number of rows */85 sysarg_t size_x; /**< Number of columns */ 86 sysarg_t size_y; /**< Number of rows */ 86 87 87 88 /** Coordinates of last printed character for determining cursor position */ 88 s ize_t position_x;89 s ize_t position_y;89 sysarg_t position_x; 90 sysarg_t position_y; 90 91 91 92 attrs_t attrs; /**< Current attributes. */ … … 107 108 * 108 109 */ 109 static inline keyfield_t *get_field_at(screenbuffer_t *scr, s ize_t x, size_t y)110 static inline keyfield_t *get_field_at(screenbuffer_t *scr, sysarg_t x, sysarg_t y) 110 111 { 111 112 return scr->buffer + x + ((y + scr->top_line) % scr->size_y) * scr->size_x; … … 120 121 * 121 122 */ 122 static inline intattrs_same(attrs_t a1, attrs_t a2)123 static inline bool attrs_same(attrs_t a1, attrs_t a2) 123 124 { 124 125 if (a1.t != a2.t) 125 return 0;126 return false; 126 127 127 128 switch (a1.t) { … … 137 138 } 138 139 139 return 0;140 return false; 140 141 } 141 142 143 extern void screenbuffer_putchar(screenbuffer_t *, wchar_t); 144 extern screenbuffer_t *screenbuffer_init(screenbuffer_t *, sysarg_t, sysarg_t); 142 145 143 void screenbuffer_putchar(screenbuffer_t *scr, wchar_t c); 144 screenbuffer_t *screenbuffer_init(screenbuffer_t *scr, size_t size_x, size_t size_y); 145 146 void screenbuffer_clear(screenbuffer_t *scr); 147 void screenbuffer_clear_line(screenbuffer_t *scr, size_t line); 148 void screenbuffer_copy_buffer(screenbuffer_t *scr, keyfield_t *dest); 149 void screenbuffer_goto(screenbuffer_t *scr, size_t x, size_t y); 150 void screenbuffer_set_style(screenbuffer_t *scr, uint8_t style); 151 void screenbuffer_set_color(screenbuffer_t *scr, uint8_t fg_color, 152 uint8_t bg_color, uint8_t attr); 153 void screenbuffer_set_rgb_color(screenbuffer_t *scr, uint32_t fg_color, 154 uint32_t bg_color); 146 extern void screenbuffer_clear(screenbuffer_t *); 147 extern void screenbuffer_clear_line(screenbuffer_t *, sysarg_t); 148 extern void screenbuffer_copy_buffer(screenbuffer_t *, keyfield_t *); 149 extern void screenbuffer_goto(screenbuffer_t *, sysarg_t, sysarg_t); 150 extern void screenbuffer_set_style(screenbuffer_t *, uint8_t); 151 extern void screenbuffer_set_color(screenbuffer_t *, uint8_t, uint8_t, uint8_t); 152 extern void screenbuffer_set_rgb_color(screenbuffer_t *, uint32_t, uint32_t); 155 153 156 154 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
