Changeset f4f866c in mainline for uspace/lib/c/include/io/screenbuffer.h
- Timestamp:
- 2010-04-23T21:42:26Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6c39a907
- Parents:
- 38aaacc2 (diff), 80badbe (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
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/io/screenbuffer.h
r38aaacc2 rf4f866c 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> 39 39 #include <sys/types.h> 40 #include <ipc/ipc.h> 40 41 #include <bool.h> 41 42 42 #define DEFAULT_FOREGROUND 0x0 /**< default console foreground color */ 43 #define DEFAULT_BACKGROUND 0xf0f0f0 /**< default console background color */ 43 typedef enum { 44 at_style, 45 at_idx, 46 at_rgb 47 } attr_type_t; 44 48 45 49 typedef struct { … … 58 62 } attr_rgb_t; 59 63 64 typedef union { 65 attr_style_t s; 66 attr_idx_t i; 67 attr_rgb_t r; 68 } attr_val_t; 69 60 70 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; 71 attr_type_t t; 72 attr_val_t a; 71 73 } attrs_t; 72 74 … … 82 84 keyfield_t *buffer; /**< Screen content - characters and 83 85 their attributes (used as a circular buffer) */ 84 size_t size_x;/**< Number of columns */85 size_t size_y;/**< Number of rows */86 ipcarg_t size_x; /**< Number of columns */ 87 ipcarg_t size_y; /**< Number of rows */ 86 88 87 89 /** Coordinates of last printed character for determining cursor position */ 88 size_t position_x;89 size_t position_y;90 ipcarg_t position_x; 91 ipcarg_t position_y; 90 92 91 93 attrs_t attrs; /**< Current attributes. */ … … 107 109 * 108 110 */ 109 static inline keyfield_t *get_field_at(screenbuffer_t *scr, size_t x, size_t y)111 static inline keyfield_t *get_field_at(screenbuffer_t *scr, ipcarg_t x, ipcarg_t y) 110 112 { 111 113 return scr->buffer + x + ((y + scr->top_line) % scr->size_y) * scr->size_x; … … 120 122 * 121 123 */ 122 static inline intattrs_same(attrs_t a1, attrs_t a2)124 static inline bool attrs_same(attrs_t a1, attrs_t a2) 123 125 { 124 126 if (a1.t != a2.t) 125 return 0;127 return false; 126 128 127 129 switch (a1.t) { … … 137 139 } 138 140 139 return 0;141 return false; 140 142 } 141 143 144 extern void screenbuffer_putchar(screenbuffer_t *, wchar_t); 145 extern screenbuffer_t *screenbuffer_init(screenbuffer_t *, ipcarg_t, ipcarg_t); 142 146 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); 147 extern void screenbuffer_clear(screenbuffer_t *); 148 extern void screenbuffer_clear_line(screenbuffer_t *, ipcarg_t); 149 extern void screenbuffer_copy_buffer(screenbuffer_t *, keyfield_t *); 150 extern void screenbuffer_goto(screenbuffer_t *, ipcarg_t, ipcarg_t); 151 extern void screenbuffer_set_style(screenbuffer_t *, uint8_t); 152 extern void screenbuffer_set_color(screenbuffer_t *, uint8_t, uint8_t, uint8_t); 153 extern void screenbuffer_set_rgb_color(screenbuffer_t *, uint32_t, uint32_t); 155 154 156 155 #endif
Note:
See TracChangeset
for help on using the changeset viewer.