Beispiel #1
0
void
drawImage()
{
    static char buf[1024];
    int j, draw = FALSE;
    TerminalImage *i;

    if (!activeImage)
	return;
    if (!n_terminal_image) {
	fputs("\x1b]99;w3m-clear\x07", stdout);
    fflush(stdout);
	return;
    }


    for (j = 0; j < n_terminal_image; j++) {
	i = &terminal_image[j];
	if (!(i->cache->loaded & IMG_FLAG_LOADED &&
	      i->width > 0 && i->height > 0))
	    continue;
    if (!activeImage)
    activeImage = TRUE;
	if (i->cache->index > 0) {
	    i->cache->index *= -1;
	    ;	/* DrawImage() */
	}
	else
	    ;	/* DrawImage(redraw) */
	sprintf(buf, "\x1b]99;w3m-draw:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%s\x07",
        i->cache->index > 0 ? 0 : 1,
		(-i->cache->index - 1) % MAX_IMAGE + 1, i->x, i->y,
		(i->cache->width > 0) ? i->cache->width : 0,
		(i->cache->height > 0) ? i->cache->height : 0,
		i->sx, i->sy, i->width, i->height, i->cache->file);
	fputs(buf, stdout);
    fflush(stdout);
	draw = TRUE;
    }
    if (!draw)
	return;
    touch_cursor();
    refresh();
}
Beispiel #2
0
void
drawImage()
{
    static char buf[64];
    int j, draw = FALSE;
    TerminalImage *i;

    if (!activeImage)
	return;
    if (!n_terminal_image)
	return;
    for (j = 0; j < n_terminal_image; j++) {
	i = &terminal_image[j];
	if (!(i->cache->loaded & IMG_FLAG_LOADED &&
	      i->width > 0 && i->height > 0))
	    continue;
	if (!(Imgdisplay_rf && Imgdisplay_wf)) {
	    if (!openImgdisplay())
		return;
	}
	if (i->cache->index > 0) {
	    i->cache->index *= -1;
	    fputs("0;", Imgdisplay_wf);	/* DrawImage() */
	}
	else
	    fputs("1;", Imgdisplay_wf);	/* DrawImage(redraw) */
	sprintf(buf, "%d;%d;%d;%d;%d;%d;%d;%d;%d;",
		(-i->cache->index - 1) % MAX_IMAGE + 1, i->x, i->y,
		(i->cache->width > 0) ? i->cache->width : 0,
		(i->cache->height > 0) ? i->cache->height : 0,
		i->sx, i->sy, i->width, i->height);
	fputs(buf, Imgdisplay_wf);
	fputs(i->cache->file, Imgdisplay_wf);
	fputs("\n", Imgdisplay_wf);
	draw = TRUE;
    }
    if (!draw)
	return;
    syncImage();
    touch_cursor();
    refresh();
}