|
From: | Cecilio Pardo |
Subject: | Re: Drawing UI elements behind text |
Date: | Wed, 27 Nov 2024 19:28:58 +0100 |
User-agent: | Mozilla Thunderbird |
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.
[Prev in Thread] | Current Thread | [Next in Thread] |