all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Oliver Scholz <alkibiades@gmx.de>
Subject: Graphics in Emacs (was: Unicode box-drawing chars)
Date: Sat, 14 Sep 2002 09:46:30 +0200	[thread overview]
Message-ID: <m365x9jbj7.fsf@ID-87814.user.dfncis.de> (raw)
In-Reply-To: vaffzwdyiho.fsf@lucy.cs.uni-dortmund.de

Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes:

> Oliver Scholz <alkibiades@gmx.de> writes:
>
>> * Check for the width as above, but care for the proper alignment by
>>   inserting spaces after the Latin font. (IIRC Emacs allows for spaces
>>   of arbitrary width.)
>
> Maybe it's possible to just draw pixels in Emacs?  If not, that might
> be a useful addition.  Then you ask Emacs about the width in pixels
> of the text and draw some lines for the box.

Well, it is already possible to generate images on the fly. This --
for example -- is from my recent experiments:

(defun egoge-make-xpm-hbar (&optional width height colour)
  (or width (setq width (frame-char-width)))
  (or height (setq height (frame-char-height)))
  (or colour (setq colour (face-attribute 'default :foreground)))
  (find-image `((:type xpm :ascent center
		       :data ,(egoge-make-xpm-hbar-data width height colour)))))


(defun egoge-make-xpm-hbar-data (width height colour)
  (let ((bar-line (truncate (/ height 2)))
	(list nil)
	(count 0))
    (while (< count height)
      (if (= count bar-line)
	  (push (make-string width ?o) list)
	(push (make-string width ?\ ) list))
      (setq count (1+ count)))
    (concat "/* XPM */\n"
	    "static char *noname[] = {\n"
	    (format "\"%d %d 2 1\",\n" width height)
	    "/* colors */\n"
	    "\"  c None\",\n"
	    (format "\"o c %s\",\n" colour)
	    "/* pixels */\n"
	    "\"" (mapconcat 'identity list "\",\n\"") "\"};")))

[It would be better to use XBM or PBM instead of XPM, but I don't know
the according specs offhand.]

Now `(insert-image (egoge-make-xpm-hbar))' inserts a horizontal
bar XPM-image with the width and height of the default font. This is,
of course, very kludgy. It is somehow strange to create a string that
is supposed to be the equivalent of an XPM-file and then to make an
image from that string. It would be nice if Emacs provided some means
to do something like this immediately. This could help to develop all
kind of fancy GUI stuff.

And while I am dreaming:

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.

For what would it be useful? I don't know yet. I am pretty sure that
someone would invent something useful or playful, if this feature were
available. I am pretty sure, that I would invent something ... :-)

One thing come to my mind: DrScheme, the editor for PLT Scheme,
provides a nice feature with vector graphics: If you hold the
mouse-pointer over a symbol in the argument-list of a function,
DrScheme draws a line from this symbol to all further occurences in
the function definition. This is supposed to help programming-newbies
to see what happens where with their arguments.

[And Emacs is supposed to be friendly to programming-newbies, too.]

> Maybe something has to be added to the display engine for this to
> work.
[...]

*sigh* To be sure, Emacs is the most wonderful application in the
 world. But there is so much missing, yet.

It is a pity that a general-purpose application is so bad at dealing
with images. ;-)

    -- Oliver

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

  reply	other threads:[~2002-09-14  7:46 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       ` Oliver Scholz [this message]
2002-09-14  6:59         ` Graphics in Emacs (was: Unicode box-drawing chars) Stefan Monnier <foo@acm.com>
2002-09-15 19:58           ` Oliver Scholz

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

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

  git send-email \
    --in-reply-to=m365x9jbj7.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.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.