Re: HowToShowImages

Steve Lamont (spl@szechuan.ucsd.edu)
Wed, 26 Feb 97 06:32:27 PST

To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> Hi! As a new user I would like to know the best way to insert Gif and
> Jpgs in my forms and if it can overlay or not text that may be under (That
> would be helpfull if it can do both easily).

It depends. First you need some way to decode JPEG or GIF. XForms
won't help you there -- you'll need some other tool set. Check the
sources for xv, ImageMagick, or one of the other freely available tool
sets.

Once you've got an array of bytes you'll need to stuff it into a
Pixmap and feed it to either the Pixmap object or to a Canvas object
if you're planing on doing something more elaborate.

If you have a TrueColor display then it's easy -- just create
an XImage, write the data into the XImage, then create a Pixmap from
the XImage (refer to your favorite Xlib manuals for details).

If you have a PseudoColor display, it's a little more complicated.
You still go through the XImage to Pixmap bit but you've first got to
color quantize the image down to (usually) 8 bits and map that lookup
table into your default Colormap (you don't want color flashing, do
you?). There is a nice octree quantization algorithm in one of the
Graphics Gems books. (I've implemented it as a library and as soon as
I'm done with The Project That Will Not End I'll get it into some sort
of distributable shape and release it).

> --
> /------\ /-------\ mail: bourci_f@epita.fr
> / /-----/ / / / http://www.epita.fr/~bourci_f
> / / / /______/ __ ___
> / /==> _ / / \ / / / / / _/ student
> / / / | |/\ /~ | / / / / / / / /-/ at
> |_/ \_| | | \_ | |_/________/ |__/ |__/ / | EPITA

Uh... this isn't directed only at this poster : can we *please* trim
the .signatures? Some of these huge .signatures are getting a bit
absurd. `Creativity' is a wonderful thing but when the .signature is
longer than the content... well, really.

Yeah, I know. Picky picky picky.

spl
Staff Curmudgeon
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/xforms-archive/