From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tomas Hlavaty Newsgroups: gmane.emacs.devel Subject: Re: Implementing image support for kitty terminal Date: Wed, 07 Sep 2022 20:56:09 +0200 Message-ID: <87wnafdnee.fsf@logand.com> References: <87v8pz18wf.fsf@mail.jao.io> <83o7vrgimc.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1066"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii , Jose Antonio Ortega Ruiz Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Sep 07 20:57:29 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 1oW0Er-000Aed-3l for ged-emacs-devel@m.gmane-mx.org; Wed, 07 Sep 2022 20:57:29 +0200 Original-Received: from localhost ([::1]:46338 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oW0Ep-0002oY-N3 for ged-emacs-devel@m.gmane-mx.org; Wed, 07 Sep 2022 14:57:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oW0Dt-00023M-8U for emacs-devel@gnu.org; Wed, 07 Sep 2022 14:56:29 -0400 Original-Received: from logand.com ([37.48.87.44]:46206) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oW0Df-0000r1-Hr; Wed, 07 Sep 2022 14:56:28 -0400 Original-Received: by logand.com (Postfix, from userid 1001) id 426F41A172E; Wed, 7 Sep 2022 20:56:11 +0200 (CEST) X-Mailer: emacs 28.1 (via feedmail 11-beta-1 I) In-Reply-To: <83o7vrgimc.fsf@gnu.org> Received-SPF: pass client-ip=37.48.87.44; envelope-from=tom@logand.com; helo=logand.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:294869 Archived-At: 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#l286 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. Second, tty emacs would need to somehow reserve rectangle for the image. This might be lots of work I guess. 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. In case of Linux console, the image path and coordinates would be sent to an external program like w3mimgdisplay.