diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-02-22 21:06:14 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-02-22 21:06:14 +0000 |
| commit | 3a24777e45238a896743707cad65f2b5bef0a708 (patch) | |
| tree | 0f524d0e80fb81e1b1086e00b771e21b768d6139 /terminal.h | |
| parent | keymap: tab: handle all modifiers (diff) | |
| parent | README: add screenshot of sixel graphics (diff) | |
Merge branch 'sixel-graphics'
Diffstat (limited to 'terminal.h')
| -rw-r--r-- | terminal.h | 41 |
1 files changed, 41 insertions, 0 deletions
@@ -131,6 +131,7 @@ struct vt { uint8_t *data; size_t size; size_t idx; + void (*put_handler)(struct terminal *term, uint8_t c); void (*unhook_handler)(struct terminal *term); } dcs; struct attributes attrs; @@ -174,6 +175,15 @@ struct ptmx_buffer { size_t idx; }; +struct sixel { + void *data; + pixman_image_t *pix; + int width; + int height; + int rows; + struct coord pos; +}; + struct terminal { struct fdm *fdm; const struct config *conf; @@ -344,6 +354,37 @@ struct terminal { int upper_fd; } delayed_render_timer; + struct { + enum { + SIXEL_DECSIXEL, /* DECSIXEL body part ", $, -, ? ... ~ */ + SIXEL_DECGRA, /* DECGRA Set Raster Attributes " Pan; Pad; Ph; Pv */ + SIXEL_DECGRI, /* DECGRI Graphics Repeat Introducer ! Pn Ch */ + SIXEL_DECGCI, /* DECGCI Graphics Color Introducer # Pc; Pu; Px; Py; Pz */ + } state; + + struct coord pos; /* Current sixel coordinate */ + int color_idx; /* Current palette index */ + int max_col; /* Largest column index we've seen (aka the image width) */ + uint32_t *palette; /* Color palette */ + + struct { + uint32_t *data; /* Raw image data, in ARGB */ + int width; /* Image width, in pixels */ + int height; /* Image height, in pixels */ + } image; + + unsigned params[5]; /* Collected parmaeters, for RASTER, COLOR_SPEC */ + unsigned param; /* Currently collecting parameter, for RASTER, COLOR_SPEC and REPEAT */ + unsigned param_idx; /* Parameters seen */ + + /* Application configurable */ + unsigned palette_size; /* Number of colors in palette */ + unsigned max_width; /* Maximum image width, in pixels */ + unsigned max_height; /* Maximum image height, in pixels */ + } sixel; + + tll(struct sixel) sixel_images; + bool hold_at_exit; bool is_shutting_down; void (*shutdown_cb)(void *data, int exit_code); |
