I'm researching a bit into what is needed for the insetgraphics, one of
the main things is to be able to read the image file and show it in the
LyX window (hmpf, that's obvious) currently this is done by going to
ghostscript and asking it to create the X11 Pixmap (or something of this
kind). This is obviously very unfriendly to the guindepence that is
intended in the (near) future, and is ugly to read and code.

When looking over the libraries on my system I found imlib which is an X
or GDK image library (it support both X and GDK). X will be usefull for
all X and GDK will be usefull for the GTK+/Gnome version.

The added bonus of this library is the fact that you can give it a file
and it will read it, parse it and render it with all that is needed, like
taking care of transparencies, enlarging/reducing, color depth with
dithering. And various other nifty features that I didn't look through.
This means that most of the work is offloaded from LyX and is given to
imlib, obviously a future native port to win32 will require another
solution (but then the current method would require that too).

What this will lead to is that in the Painter class we'll have a
drawImage() that will load and render the image.

Several problems that come to my mind now, one thing is that imlib doesn't
handle eps natively, it uses netpbm or ImageMagick to translate that (we
use ghostscript, it cant be any worse than what we have now). 

Another problem is that I do not know if it works in the background or
will try to load the image immediately (delaying the user), this can
probably be overcome by using a thread/fork to load it in the background,
much as we do now.

And the last problem is that it will require additional dependency from
LyX. We currently use XPM library, and I tried to see if it will be
usefull, however it seems that translating to XPM is wastefull, and XPM is
intended for icons mostly, so the hard work will probably fall on us (that
is, me), the plus side of XPM is that it's more likely to be installed
almost everywhere (a.e. of measure theory for the mathematicians of us).

What do you say?

-- 
  Baruch Even

http://techst02.technion.ac.il/~sbaruch/   (My Site)
http://rpghost.com/jindor/                 (My brothers AD&D site)

" Learn to laugh ... it's the path to true love! " 
   - The Angel in the movie Michael


Reply via email to