[wip] Initial stab on inline images support, with many problems
[elinks/images.git] / src / terminal / screen.h
blob00c11380f21a329b2e877971c30440eb4ffb98f1
1 #ifndef EL__TERMINAL_SCREEN_H
2 #define EL__TERMINAL_SCREEN_H
5 struct module;
6 struct screen_char;
7 struct terminal;
9 /** The terminal's screen manages */
10 struct terminal_screen {
11 /** This is the screen's image, character by character. */
12 struct screen_char *image;
14 /** The previous screen's image, used for optimizing actual drawing. */
15 struct screen_char *last_image;
17 /** The current and the previous cursor positions. */
18 int cx, cy;
19 int lcx, lcy;
21 /** The range of line numbers that are out of sync with the physical
22 * screen. #dirty_from > #dirty_to means not dirty. */
23 int dirty_from, dirty_to;
26 /** Mark the screen ready for redrawing. */
27 static inline void
28 set_screen_dirty(struct terminal_screen *screen, int from, int to)
30 int_upper_bound(&screen->dirty_from, from);
31 int_lower_bound(&screen->dirty_to, to);
34 /** Initializes a screen. Returns NULL upon allocation failure. */
35 struct terminal_screen *init_screen(void);
37 /** Cleans up after the screen. */
38 void done_screen(struct terminal_screen *screen);
40 /** Update the size of the previous and the current screen image to
41 * hold @a width time @a height chars. */
42 void resize_screen(struct terminal *term, int width, int height, int xres, int yres);
44 /** Updates the terminal screen. */
45 void redraw_screen(struct terminal *term);
47 /** Erases the entire screen and moves the cursor to the upper left corner. */
48 void erase_screen(struct terminal *term);
50 /** Meeep! */
51 void beep_terminal(struct terminal *term);
53 extern struct module terminal_screen_module;
55 #endif