aboutsummaryrefslogtreecommitdiffstats
path: root/terms.c
diff options
context:
space:
mode:
authorAraki Ken <arakiken@users.sf.net>2014-09-22 11:16:39 +0000
committerTatsuya Kinoshita <tats@debian.org>2014-12-06 11:47:05 +0000
commit2fe66f3a6f1b1fd28424a2f14beebdd535e9d17b (patch)
tree546648d217e82e218d22d20e90cc46acc2bd0e72 /terms.c
parentDon't download image files whose size is specified in <img> tag. (diff)
downloadw3m-2fe66f3a6f1b1fd28424a2f14beebdd535e9d17b.tar.gz
w3m-2fe66f3a6f1b1fd28424a2f14beebdd535e9d17b.zip
Add -sixel option which supports image processing by img2sixel.
Diffstat (limited to '')
-rw-r--r--terms.c18
1 files changed, 17 insertions, 1 deletions
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)
{