From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jose A Ortega Ruiz Newsgroups: gmane.emacs.devel Subject: Re: Implementing image support for kitty terminal Date: Wed, 07 Sep 2022 20:59:55 +0100 Message-ID: <87a67bymys.fsf@mail.jao.io> References: <87v8pz18wf.fsf@mail.jao.io> <83o7vrgimc.fsf@gnu.org> <87wnafdnee.fsf@logand.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36372"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Tomas Hlavaty , Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Sep 07 22:02:03 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oW1FL-0009Ge-82 for ged-emacs-devel@m.gmane-mx.org; Wed, 07 Sep 2022 22:02:03 +0200 Original-Received: from localhost ([::1]:37826 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oW1FJ-00025y-R4 for ged-emacs-devel@m.gmane-mx.org; Wed, 07 Sep 2022 16:02:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40562) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oW1DQ-0000mG-EU for emacs-devel@gnu.org; Wed, 07 Sep 2022 16:00:06 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:60292) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oW1DN-0001JQ-N2; Wed, 07 Sep 2022 16:00:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=AHnJwrmyXmtYnA1hW+qlMoiE6LVzM3jfSW4I018Y+J4=; b=hOJYmKkXUzQXn75F2nVj wS6wyqxD9j1m4syo1DgcGOCQvYH6i3Qjsdecnkq60xThmCYWTUbG930TUDN3wbZh9xvF+CG0myGHM DJrg+hyMRBc86zJgCjRU4ImwpWtiVnoMpVJh+UsuUmR6geo22Npy27i7W9axE5WhBKfW7bKkv/eRJ 3/iu+aM7EVxNvFlFgcoHKalSyKMFrQAUwNfBBCwM0j+OXqNHOYeIFc4BTTVXTbEcOqmLFH3lJ5uVX GEp5rG9FrRMj9ZH2u2m1UCM8M4IrtZba8eWuTkckC0QOuGwX+WdpdvDS8UAadHXFx546FKSLFAqtZ ZgDU5NC5/JgUeA==; Original-Received: from cpc103048-sgyl39-2-0-cust502.18-2.cable.virginm.net ([92.233.85.247]:40128 helo=rivendell.localdomain) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oW1DL-0006oy-At; Wed, 07 Sep 2022 16:00:01 -0400 Original-Received: from localhost (rivendell.localdomain [local]) by rivendell.localdomain (OpenSMTPD) with ESMTPA id 5ba543dd; Wed, 7 Sep 2022 19:59:55 +0000 (UTC) In-Reply-To: <87wnafdnee.fsf@logand.com> X-Attribution: jao X-Clacks-Overhead: GNU Terry Pratchett X-URL: X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:294875 Archived-At: On Wed, Sep 07 2022, Tomas Hlavaty wrote: > On Wed 07 Sep 2022 at 21:11, Eli Zaretskii wrote: >> In particular, the current model of image display >> in the Emacs display engine is that an image is basically considered a >> single very large character, from the screen layout POV. > > Are you talking about GUI emacs? > Is that not different in tty emacs? > I thought that the tty emacs has no concept of image (so far?). > >> I guess >> that's not what you have in mind for the above, so IMO it's important >> to come up with an alternative model that would somehow fit with the >> current display code with only minor changes, if we want this not to >> be too complex. > > For example, the tty based w3m web browser optionally supports images. > It reserves space w*h chars on the tty and then uses external program > to draw the image in the right place. > > I guess tty emacs would also need to reserve a w*h chars rectangle on > the tty and then send the right escape code to fill that gap with the > image. > > First, tty emacs would need to understand images instead of throwing > error. At least their dimensions. Maybe using some library or even in > elisp, for example like this > https://logand.com/sw/emacs-framebuffer/file/emacs-framebuffer.el.html#l2= 86 > I have not figured out, how to actually plug it into upstream emacs, as > this seems to require a lot of changes to C code. fwiw, in the kitty case, image libraries are going to be almost for sure available, it being an x11/wayland application. so an emacs compiled with image support (but not necessarily linking against any x libs) doesn't seem like a strong requirement. in that scenario, determining the size of an image wouldn't needed a lot of C code, would it? and, if those libraries are not available, a call to "file foo.png" is (at least in my system) telling me the size of foo.png... kind of hacky, of course, but as a first step maybe good enough. > Second, tty emacs would need to somehow reserve rectangle for the image. > This might be lots of work I guess. i was hoping this wouldn't be the case... at least when running inside terminal emulators, emacs nox seems pretty dexterous lying out windows and filly them with content, and i reckoned it must have a pretty good idea of their sizes. but maybe i'm too optimistic :) > Third, there would have to be a piece of code which actually draws the > image. In case of kitty terminal, the image path and coordinates would > be sent to the tty using the kitty terminal protocol. (as an aside, this would also work for other terminals like konsole or wayst, which support the protocol). cheers, jao --=20 If we all think alike then nobody=E2=80=99s thinking at all.