From 2fe66f3a6f1b1fd28424a2f14beebdd535e9d17b Mon Sep 17 00:00:00 2001 From: Araki Ken Date: Mon, 22 Sep 2014 20:16:39 +0900 Subject: Add -sixel option which supports image processing by img2sixel. --- terms.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'terms.c') diff --git a/terms.c b/terms.c index 6533712..53d604c 100644 --- a/terms.c +++ b/terms.c @@ -467,7 +467,7 @@ writestr(char *s) #define MOVE(line,column) writestr(tgoto(T_cm,column,line)); void -put_image(char *url, int x, int y, int w, int h, int sx, int sy, int sw, int sh) +put_image_osc5379(char *url, int x, int y, int w, int h, int sx, int sy, int sw, int sh) { Str buf; char *size ; @@ -483,6 +483,22 @@ put_image(char *url, int x, int y, int w, int h, int sx, int sy, int sw, int sh) MOVE(Currentbuf->cursorY,Currentbuf->cursorX); } +void +put_image_sixel(char *url, int x, int y, int w, int h, int sx, int sy, int sw, int sh) +{ + Str buf; + + MOVE(y,x); + flush_tty(); + buf = Sprintf("img2sixel -l disable -c %dx%d+%d+%d -w %d -h %d %s 2>/dev/null", + sw*pixel_per_char_i, sh*pixel_per_line_i, + sx*pixel_per_char_i, sy*pixel_per_line_i, + w*pixel_per_char_i, h*pixel_per_line_i, + url); + system(buf->ptr); + MOVE(Currentbuf->cursorY,Currentbuf->cursorX); +} + int get_pixel_per_cell(int *ppc, int *ppl) { -- cgit v1.2.3