forked from kisonecat/fbpad-eink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fbpad.h
77 lines (65 loc) · 2.1 KB
/
fbpad.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* fbpad header file */
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define LEN(a) (sizeof(a) / sizeof((a)[0]))
#define ESC 27 /* escape code */
#define NCOLS 256 /* maximum number of screen columns */
#define NROWS 128 /* maximum number of screen rows */
#define NDOTS 1024 /* maximum pixels in glyphs */
#define NHIST 128 /* scrolling history lines */
/* isdw.c */
#define DWCHAR 0x40000000u /* 2nd half of a fullwidth char */
int isdw(int c);
int iszw(int c);
/* term.c */
struct term_state {
int row, col;
int fg, bg;
int mode;
};
struct term {
int screen[NROWS * NCOLS]; /* screen content */
int hist[NHIST * NCOLS]; /* scrolling history */
int fgs[NROWS * NCOLS]; /* foreground color */
int bgs[NROWS * NCOLS]; /* background color */
int dirty[NROWS]; /* changed rows in lazy mode */
struct term_state cur, sav; /* terminal saved state */
int fd; /* terminal file descriptor */
int hrow; /* the next history row in hist[] */
int hpos; /* scrolling history; position */
int lazy; /* lazy mode */
int pid; /* pid of the terminal program */
int top, bot; /* terminal scrolling region */
};
void term_load(struct term *term, int visible);
void term_save(struct term *term);
void term_read(void);
void term_send(int c);
void term_exec(char **args);
void term_end(void);
void term_screenshot(void);
void term_scrl(int pos);
void term_redraw(int all);
/* pad.c */
#define FN_I 0x01000000 /* italic font */
#define FN_B 0x02000000 /* bold font */
#define FN_C 0x00ffffff /* font color mask */
int pad_init(void);
void pad_free(void);
int pad_font(char *fr, char *fi, char *fb);
void pad_put(int ch, int r, int c, int fg, int bg);
int pad_rows(void);
int pad_cols(void);
int pad_refresh(void);
void pad_fill(int sr, int er, int sc, int ec, int c);
/* font.c */
struct font *font_open(char *path);
void font_free(struct font *font);
int font_rows(struct font *font);
int font_cols(struct font *font);
int font_bitmap(struct font *font, void *dst, int c);
/* scrsnap.c */
void scr_snap(int idx);
int scr_load(int idx);
void scr_free(int idx);
void scr_done(void);