unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Oliver Scholz <alkibiades@gmx.de>
Subject: Re: Graphics in Emacs (was: Unicode box-drawing chars)
Date: Sun, 15 Sep 2002 21:58:53 +0200	[thread overview]
Message-ID: <m31y7vhwnv.fsf@ID-87814.user.dfncis.de> (raw)
In-Reply-To: 5l65x9qco0.fsf@rum.cs.yale.edu

[-- Attachment #1: Type: text/plain, Size: 2275 bytes --]

"Stefan Monnier <foo@acm.com>" <monnier+gnu.emacs.help/news/@flint.cs.yale.edu> 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
example:

`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:

(progn
  (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 #2: make-xpm-box.el --]
[-- Type: application/emacs-lisp, Size: 9969 bytes --]

[-- Attachment #3: Type: text/plain, Size: 72 bytes --]


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

      reply	other threads:[~2002-09-15 19:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-12 14:42 Unicode box-drawing chars Oliver Scholz
2002-09-12 13:27 ` Jesper Harder
2002-09-12 14:09   ` Kai Großjohann
2002-09-13  1:15     ` Galen Boyer
2002-09-13  1:36     ` Jesper Harder
2002-09-13 12:04       ` Oliver Scholz
2002-09-14 20:49         ` Jesper Harder
2002-09-12 13:56 ` Kai Großjohann
2002-09-12 15:44   ` Roman Belenov
2002-09-13 11:57   ` Oliver Scholz
2002-09-13 16:14     ` Kai Großjohann
2002-09-14  7:46       ` Graphics in Emacs (was: Unicode box-drawing chars) Oliver Scholz
2002-09-14  6:59         ` Stefan Monnier <foo@acm.com>
2002-09-15 19:58           ` Oliver Scholz [this message]

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=m31y7vhwnv.fsf@ID-87814.user.dfncis.de \
    --to=alkibiades@gmx.de \
    /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.
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).