Rev 4338 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4338 | Rev 4348 | ||
---|---|---|---|
Line 34... | Line 34... | ||
34 | 34 | ||
35 | #ifndef __SCREENBUFFER_H__ |
35 | #ifndef __SCREENBUFFER_H__ |
36 | #define __SCREENBUFFER_H__ |
36 | #define __SCREENBUFFER_H__ |
37 | 37 | ||
38 | #include <stdint.h> |
38 | #include <stdint.h> |
- | 39 | #include <sys/types.h> |
|
39 | 40 | ||
40 | #define DEFAULT_FOREGROUND 0x0 /**< default console foreground color */ |
41 | #define DEFAULT_FOREGROUND 0x0 /**< default console foreground color */ |
41 | #define DEFAULT_BACKGROUND 0xf0f0f0 /**< default console background color */ |
42 | #define DEFAULT_BACKGROUND 0xf0f0f0 /**< default console background color */ |
42 | 43 | ||
43 | typedef struct { |
44 | typedef struct { |
Line 68... | Line 69... | ||
68 | } a; |
69 | } a; |
69 | } attrs_t; |
70 | } attrs_t; |
70 | 71 | ||
71 | /** One field on screen. It contain one character and its attributes. */ |
72 | /** One field on screen. It contain one character and its attributes. */ |
72 | typedef struct { |
73 | typedef struct { |
73 | char character; /**< Character itself */ |
74 | wchar_t character; /**< Character itself */ |
74 | attrs_t attrs; /**< Character`s attributes */ |
75 | attrs_t attrs; /**< Character`s attributes */ |
75 | } keyfield_t; |
76 | } keyfield_t; |
76 | 77 | ||
77 | /** Structure for buffering state of one virtual console. |
78 | /** Structure for buffering state of one virtual console. |
78 | */ |
79 | */ |
Line 89... | Line 90... | ||
89 | * @param scr screenbuffer |
90 | * @param scr screenbuffer |
90 | * @param x position on screen |
91 | * @param x position on screen |
91 | * @param y position on screen |
92 | * @param y position on screen |
92 | * @return keyfield structure with character and its attributes on x,y |
93 | * @return keyfield structure with character and its attributes on x,y |
93 | */ |
94 | */ |
94 | static inline keyfield_t *get_field_at(screenbuffer_t *scr, unsigned int x, unsigned int y) |
95 | static inline keyfield_t *get_field_at(screenbuffer_t *scr, unsigned int x, unsigned int y) |
95 | { |
96 | { |
96 | return scr->buffer + x + ((y + scr->top_line) % scr->size_y) * scr->size_x; |
97 | return scr->buffer + x + ((y + scr->top_line) % scr->size_y) * scr->size_x; |
97 | } |
98 | } |
98 | 99 | ||
99 | /** Compares two sets of attributes. |
100 | /** Compares two sets of attributes. |
Line 114... | Line 115... | ||
114 | a1.a.r.bg_color == a2.a.r.bg_color; |
115 | a1.a.r.bg_color == a2.a.r.bg_color; |
115 | } |
116 | } |
116 | } |
117 | } |
117 | 118 | ||
118 | 119 | ||
119 | void screenbuffer_putchar(screenbuffer_t *scr, char c); |
120 | void screenbuffer_putchar(screenbuffer_t *scr, wchar_t c); |
120 | screenbuffer_t *screenbuffer_init(screenbuffer_t *scr, int size_x, int size_y); |
121 | screenbuffer_t *screenbuffer_init(screenbuffer_t *scr, int size_x, int size_y); |
121 | 122 | ||
122 | void screenbuffer_clear(screenbuffer_t *scr); |
123 | void screenbuffer_clear(screenbuffer_t *scr); |
123 | void screenbuffer_clear_line(screenbuffer_t *scr, unsigned int line); |
124 | void screenbuffer_clear_line(screenbuffer_t *scr, unsigned int line); |
124 | void screenbuffer_copy_buffer(screenbuffer_t *scr, keyfield_t *dest); |
125 | void screenbuffer_copy_buffer(screenbuffer_t *scr, keyfield_t *dest); |