unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Cecilio Pardo <cpardo@imayhem.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: jdtsmith@gmail.com, emacs-devel@gnu.org
Subject: Re: Drawing UI elements behind text
Date: Wed, 27 Nov 2024 19:28:58 +0100	[thread overview]
Message-ID: <b27f4d2f-95d4-405d-8119-d1abb022d1b4@imayhem.com> (raw)
In-Reply-To: <86plmgg2vx.fsf@gnu.org>

On 27/11/2024 15:36, Eli Zaretskii wrote:
>> Date: Wed, 27 Nov 2024 00:19:43 +0100
>> Cc: emacs-devel <emacs-devel@gnu.org>
>> From: Cecilio Pardo <cpardo@imayhem.com>
>>
>> I haven't found a way to draw behind the text that is not too
>> complicated or affects redisplay too much. So now the idea is drawing
>> over the text. For the applications I have in mind this works equally well.
>>
>> The starting drawing elements are going to be vertical and horizontal
>> segments, with color (maybe with alpha), width and different patterns.
>> They can be placed on pixel positions or character positions when using
>> fixed size fonts, using floating point numbers so you can put, for
>> example, indent lines in the middle of characters.
>>
>> They are associated with a buffer, and have a 'source' marker so the
>> facility can be shared by several programs.
> 
> How/whether are these drawing elements connected to the glyph
> matrices?
> 
> If they are completely disconnected, how does this work when the
> window is scrolled several lines?

They are anchored at locations on the buffer, specified by line/column. 
This is transformed into pixels using the size of the default char cell 
for the buffer.  The buffer scroll position on each window is used to 
compute the final position on the frame/screen.

For buffers that use different font sizes or images this is probably not 
very useful. Direct pixel positions can be used too.

They are drawn after switching the back paint buffer, so that the 
redisplay result is left alone.

At first I tried intercepting the background clearing to draw behind the 
text. But to allow for redisplay to reuse the output I had to redraw the 
glyphs affected with a clear background, and this was too costly in the 
worst cases.

I will have a patch in a few days.





  reply	other threads:[~2024-11-27 18:28 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-10 16:39 Drawing UI elements behind text Cecilio Pardo
2024-11-10 18:09 ` Jim Porter
2024-11-10 18:44   ` Eli Zaretskii
2024-11-10 19:06     ` Jim Porter
2024-11-10 19:22       ` Eli Zaretskii
2024-11-10 19:29         ` Jim Porter
2024-11-10 19:42           ` Eli Zaretskii
2024-11-24 23:37 ` JD Smith
2024-11-26 23:19   ` Cecilio Pardo
2024-11-27 14:36     ` Eli Zaretskii
2024-11-27 18:28       ` Cecilio Pardo [this message]
2024-11-27 18:58         ` Eli Zaretskii
2024-11-27 20:01           ` Cecilio Pardo
2024-11-27 20:12             ` Eli Zaretskii
2024-11-27 20:30               ` Cecilio Pardo
2024-11-28  6:53                 ` Eli Zaretskii
2024-11-28  8:43                   ` Cecilio Pardo
2024-11-28  9:57                     ` Eli Zaretskii
2024-11-28 10:41                       ` Cecilio Pardo
2024-11-28 11:56                         ` Eli Zaretskii
2024-11-28 12:09                           ` Cecilio Pardo
2024-11-27 21:15           ` JD Smith
2024-11-27 21:47             ` Cecilio Pardo
  -- strict thread matches above, loose matches on Subject: below --
2024-11-27  2:31 JD Smith
2024-11-27 18:33 ` Cecilio Pardo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b27f4d2f-95d4-405d-8119-d1abb022d1b4@imayhem.com \
    --to=cpardo@imayhem.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=jdtsmith@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).