With that I mean UI elements (for example text fields and animated buttons) that are not restricted to the monospaced character grid of terminal emulators, but can be arbitrary shapes at arbitrary pixel positions on the screen. I’m simply curious whether and how that is possible, and if it’s not possible, whether it’s planned for the future.
-
2Well, yes – the splash screen is evident to this fact. I would reword your question into *how* this can be done. As it stands, a simple yes/no answer would 'answer' this question. – Sean Allred Nov 24 '14 at 01:25
-
3If you only want to draw, then yes, you can see. See the `svg-clock` package in GNU ELPA for a "simple" example. But if you want to draw *on top* of other elements, then the answer is sadly "no", although many people would be happy if someone were to write a patch that does that. – Stefan Nov 24 '14 at 13:47
-
1@SeanAllred arbitrary shape, yes; arbitrary pixel position, no. – Malabarba Nov 24 '14 at 15:18
-
@Malabarba Whoops -- yes, you're correct. You can cheat though with display margins and text faces, though -- you can get pretty precise. But you're right in saying that you cannot say `Draw image.png(400x600+16+30)` to draw a scaled image at that particular coordinate relative to some corner. – Sean Allred Nov 24 '14 at 16:47
2 Answers
Textfields and buttons (like, in the Customize buffers) are actually subject to the grid Emacs aligns characters on.
What you can do is telling Emacs to display an image of the SVG (vector) or XPM (bitmap) type. Since those aren't limited to be read in from a file, you can generate a string and turn it into an image. I've seen examples of both canvas-like usage where the image occupies most of the window and is freely drawn on (see svg-thing, slime-volley, svg-clock, my own svg-2048) and less obnoxious usage which rather resemble UI elements (see the icons in AUCTEX, gnus' modeline icon, the graphical version of M-x tetris
, svg-modeline). There's still quite a bit of footwork to do considering Emacs does not have a canvas-like image type, but it's possible to displace these images and to use them as display property of other UI elements like the modeline or margin and bind keys including the mouse ones to them.

- 21,803
- 1
- 65
- 97