emacs-devel
[Top][All Lists]
Advanced

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

Re: XPM images


From: Oliver Scholz
Subject: Re: XPM images
Date: Mon, 30 Sep 2002 14:10:45 +0200
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.3.50 (i686-pc-linux-gnu)

Richard Stallman <address@hidden> writes:

>     ;; `defstruct' generates a bunch of ugly byte-compiler warnings, so we
>     ;; do this manually.
>     (defun make-xpm-pixmap (&rest keyword-args)
>       "Create and return a `xpm-pixmap'.
>
> I am having trouble understanding the code because nothing says
> what purpose this data structure is used for.  

It is only an intermediate storage format, because I wanted the
functions that generate the PPM-string and the final image to be as
ignorant as possible of what the parsing-functions do. This was my
idea of cleanness at that time and it has proven to be at least
valuable for myself during the course of writing. But if this
separation seems unnecessary, it is quite possible to remove this
code.

> The file needs an overall description of the logic.

I see. I will add such a commentary section.

> It also needs the info on what the entry points are and what they do.

My apologies. Only two functions are supposed to be used from the
"outside": `xpm-image-from-file' and `xpm-image-from-string'. But now
that I am currently looking at images.el again, I think that I should
merge them into a single function `xpm-create-image' which takes
similar arguments as `create-image'. This makes a patch to images.el
simpler.

> None of the functions says it produces or outputs a PPM,
> and I can't figure out which function is supposed to do that.

The only place where PPM occurs is the function
`xpm-pixmap-to-ppm-string' which takes the data structure you
mentioned above as argument and returns a string (which, when saved to
a file, would be a valid PPM image.) PPM is, again, only an
intermediate format (as the format was indeed invented only to be an
intermediate format in image conversion). Besides that, the whole
process of converting to and applying PPM was meant to be
transparent. What the two main functions `xpm-image-from-string' and
`xpm-image-from-file' actually return is an image descriptor, as a
function like `insert-image' takes it as an argument. But I refer to
the image descriptors in the doc-strings only as "images"; thus
mimicking the documentation strings of `insert-image', `create-image'
or `find-image'.

    -- Oliver

-- 
Oliver Scholz               9 Vendémiaire an 211 de la Révolution
Taunusstr. 25               Liberté, Egalité, Fraternité!
60329 Frankfurt a. M.       http://www.jungdemokratenhessen.de
Tel. (069) 97 40 99 42      http://www.jdjl.org




reply via email to

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