As I've told Steve already, I'm the author of the new Emacs redisplay,
you may have heard of.
The new Emacs redisplay code supports the inclusion of images in
buffer text, among other things. Since it does that in a way that is
not compatible with XEmacs, Richard, Steve and I agree that it is a
good idea to provide a compatibility layer for displaying images,
analogous in scope and intent to `easymenu', to package authors.
The following is a proposal of such a common interface, that I call
`easyimage'.
`easyimage.el'
==============
- Function: easy-image-types
Return a list of supported image types.
Each element of the list is a symbol describing a supported image
type. The following symbols are used
xbm
xpm
xface
gif
jpeg
png
tiff
pbm
ghostscript
Rationale: One can use `featurep' to test for the availability of an
image type in XEmacs. Emacs instead has a list of supported types. I
believe the list form could be useful for extensions that would like
to present available image type to the user (customization (?)).
- Function: easy-image-create TYPE FILE
Return an image of type TYPE loaded from file FILE.
TYPE is a symbol specifying the image type. FILE is the path of the
file to be loaded. If FILE doesn't specify an absolute path after
`expand-file-name', it's taken to be relative to `data-directory'.
Rationale: I believe that loading images from files is the most common
case, and the case both Emacs types support. (Please also see
`defimage', below).
- Function: easy-image-put IMAGE POS &optional AREA BUFFER
Put image IMAGE in front of POS in BUFFER.
IMAGE is an image created via `easy-image-create' or `defimage'. POS
is a buffer position, an integer or a marker.
AREA is a symbol or nil. If it is `left-margin' put the image into
the left margin area, if it is `right-margin' put it in the right
marginal area. If it is `nil' or omitted, put it in the text area.
BUFFER nil or omitted means use the current buffer.
- Function: easy-image-remove-images START END &optional BUFFER
Remove images between START and END in BUFFER.
START and END are buffer positions, and may be either integers or
markers. BUFFER nil or omitted means use the current buffer.
- Macro: defimage IMAGE SPECS &optional DOC-STRING
Declare IMAGE as an image.
IMAGE is a symbol; it doesn't have to be quoted. SPECS is a list of
image specifications. DOC-STRING is a documentation string.
The function chooses the first applicable image specification from
SPECS, creates an image for it and assigns it to IMAGE via `setq'.
Each specification in SPECS is a list. If it has the form (EMACS
...), where EMACS is the the symbol `emacs' or `xemacs', the
specification is applicable only if running under the named Emacs
type.
The contents of the rest of a specification are unspecified, but both
Emacs brands support specifications of the form `(:type TYPE :file
FILE)' (see `easy-image-create'). A specification of this form is
applicable if image type TYPE is available, and FILE exists.