[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Graphics in Emacs (was: Unicode box-drawing chars)

From: Oliver Scholz
Subject: Re: Graphics in Emacs (was: Unicode box-drawing chars)
Date: Sun, 15 Sep 2002 21:58:53 +0200
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i686-pc-linux-gnu)

"Stefan Monnier <address@hidden>" 
<> writes:

>> A few months ago someone posted a patch in gnu.emacs.sources that
>> allows to draw pixels immediately on the screen. This would allow
>> basic vector graphics in Emacs. I'd like to see that included to.
> Problem is that it was hopelessly broken since it did not hook into
> the redisplay loop (i.e. the pixels were overwritten at every C-l).

Hmm, what a pity. Is this only a problem with `recenter' or does this
affect -- for example -- scrolling, too?

Emacs is not able to display an image behind some text, is it? (I have
not yet installed the CVS version. I will do it soon, but I am short
of disk space at the moment.)

If it were, and if we had a function to change images directly, we
could use this for simple vector graphics.

Let me expand a bit on the functions to change an image directly that
I asked for in my previous mail. Pardon me, if the following
suggestion is silly. I don't know anything about Emacs's internals and
anything but Elisp is pure Sanskrit to me.

As I understand it, when a function inserts an image via an image
specifier, Emacs creates that image in the image cache from the data
in the specifier. If a function uses the same image-specifier again
("the same" meaning `eq' here), Emacs uses the same object in the
image cache again.

Now I would like to have a way to a) create an empty image, and b) a
way to set a pixel in an image in the image cache directly. For

`make-image width height' creates an empty image in the image cache
and returns an image specifier for that image.

`set-pixel image x y colour' sets a pixel at position X, Y to colour
COLOUR. IMAGE is an image-specifier.

As I said, this could be useful for some fancy widgets in Emacs. I
have written some proof-of-concept code yesterday (see below). It goes
the kludgy way by creating an XPM-data-string. The code became a bit
longer as I expected. I post it here, though, and not in
gnu.emacs.sources, because it is not intended to be used but as a
demonstration in this discussion.

Test it like this:

  (switch-to-buffer (generate-new-buffer "*Test*"))
  (egoge-insert-in-box "Dies ist nichts weiter als ein blöder Test." 20 20 10))

    -- Oliver

Attachment: make-xpm-box.el
Description: application/emacs-lisp

29 Fructidor an 210 de la Révolution
Liberté, Egalité, Fraternité!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]