Some of SIXEL output path.

This commit is contained in:
Nicholas Marriott
2026-10-14 11:04:00 +01:00
parent 9a37890133
commit d68e56f130
7 changed files with 307 additions and 9 deletions

View File

@@ -21,12 +21,13 @@
#define TMUX_IMAGE_H
#ifdef ENABLE_IMAGES
#error image support is not ready yet
//#error image support is not ready yet
struct grid;
struct grid_cell;
struct grid_line;
struct image;
struct image_backend;
struct image_line;
struct image_store;
struct screen;
@@ -37,6 +38,12 @@ struct tty;
/* Maximum image size in bytes. */
#define IMAGE_SIZE_LIMIT (64 * 1024 * 1024)
/* Backend draws images as graphics. */
#define IMAGE_BACKEND_GRAPHICAL 0x1
/* Backend images move with terminal scrolling. */
#define IMAGE_BACKEND_SCROLLS 0x2
/* View of all or part of an image. */
struct image_view {
/* Position and size in the image, in pixels. */
@@ -60,6 +67,23 @@ struct image_view {
u_int sy;
};
/* A part of an image to draw. */
struct image_rect {
struct image *image;
/* Size in cells. */
u_int sx;
u_int sy;
/* Source in image in cells. */
u_int src_x;
u_int src_y;
/* Destination on terminal in cells. */
u_int dst_x;
u_int dst_y;
};
/* image.c */
struct image *image_create(u_int, u_int, u_int, u_int, u_int, u_int,
u_char *);
@@ -102,13 +126,20 @@ void image_damage_screen(struct screen_write_ctx *, u_int, u_int,
void image_write(struct screen_write_ctx *, struct image *, u_int);
int image_grid_get_at(struct grid *, u_int, u_int, struct image **,
u_int *, u_int *);
void image_redraw_start(struct tty *, u_int, u_int, u_int, u_int);
void image_draw_flush(struct tty *);
int image_tty_update(struct tty *);
void image_tty_size_changed(struct tty *);
void image_tty_free(struct tty *);
/* image-fallback.c */
int fallback_select(struct tty *);
const struct grid_cell *fallback_map_cell(struct tty *, struct grid *, u_int,
u_int, const struct grid_cell *, struct grid_cell *, int *);
/* image-sixel.c */
#define SIXEL_COLOUR_REGISTERS 1024
int sixel_select(struct tty *);
struct sixel_image *sixel_parse(const char *, size_t, u_int, u_int, u_int,
u_int);
void sixel_free(struct sixel_image *);
@@ -118,6 +149,10 @@ void sixel_write(struct screen_write_ctx *, struct sixel_image *,
u_int);
char *sixel_from_image(struct image *, u_int, u_int, u_int, u_int,
u_int, u_int, size_t *);
void sixel_draw_rect(struct tty *, struct image_rect *);
void sixel_start_draw(struct tty *, u_int, u_int, u_int, u_int);
void sixel_free_pending(struct tty *);
void sixel_flush_pending(struct tty *);
#endif /* ENABLE_IMAGES */