[comp.emacs] what would an emacs graphics editor look like ?

pauld@scenic.wa.com (Paul Barton-Davis) (01/05/91)

Some musings for the interested: I've been trying to consider what an
emacs-influenced graphics editor would look like. Fairly obviously,
emacs would not have much impact on the primary user interface -- its
too hard to use the keyboard for that. The obvious contribution would
be an extension language, preferably lisp. This is the big hallmark of
good large software tools, IMHO, and is actually part of the reason
why this question came up -- Adobe's Photoshop does not do all we want
(writing polygonal cropping paths into the output TIFF file, for the
interested), but cannot be extended in the right way.

So, what extensions (mild understatement) would one want in lisp to
allow proper graphics editing ? I should make it clear that I consider
object oriented graphics a subset of raster graphics (something has to
draw pixels sooner or later), and so what seems needed is a set of
primitives to do basic raster buffer operations (exchange raster
planes, invert, cut various areas out, apply arbitrary n-bit deep
transforms to an arbitrary section of a raster buffer etc.)

My first thought was to add raster buffers and a suitable set of
operators to Emacs Lisp's basic object.  However, the more one thinks
about this, it becomes clear that the language already exists. Its
called PostScript.  PostScript suffers from (1) stack based notation
(2) being a dog of a CPU eater, but it is totally general, and works.
When you run it on an AMD 29000 coprocessor, its even acceptably quick
at doing raster operations.

So the question now mutates into something like: how could one set up
a lisp interface to a graphics editor that was essentially a front end
for a PostScript interpreter ? This seems an eminently attractive
thing to do with X now becoming so standard. I know of one possibility
- the various versions of LispScript that have floated around (a
preprocessor that converts lisp into postscript). There may be others.

I am quite excited about the idea of sitting on a Sun, with emacs and
this new graphics editor sitting side by side, using the mouse to cut
out a section of the image, and then typing the following into a
"postlisp" buffer"

	(setq swapped-area (cut-raster (current-path))
            (exchange-raster-planes 'red 'blue))
	(setq blownup-swapped-area 
	    (enlarge (dither swapped-area 0.25) 
		(/ (path-area (raster-path (current-raster)))
		   (path-area (current-path))))
	(replace-raster-plane 'green
	    (pixel-transform 'my-pt blownup-swapped-area))

	[ this is purely illustrative had has some bad examples of
	  Lisp coding style ]

Typing ^J would then (possibly evaluate and) send this to the editor
for processing ...

However, clearly, such support involves a *lot* of work. I'd like to
invite comments on the sense of such a venture, on other tools that
offer such functionality, or on ways to go about it. If you've already
done it, all the better ...

Paul Barton-Davis			<pauld@scenic.wa.com>
ScenicSoft, Inc.	
(206) 776-7760		"To shatter tradition makes us feel free"