Re: XForms: Palette & Linear Bitmap questions

Steve Lamont (spl@szechuan.ucsd.edu)
Fri, 15 Aug 97 07:37:58 PDT

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

> Question 1: How to set the Palette ...
> I have a description of the 256-color palette used under svgalib: I know
> the red, green and blue components (on a 0-63 scale) for each color.
> I was thinking of leaving the first 64 colors untouched (for xforms
> decorations) and mapping my palette into the next 256 colors, like so:
> for (c=0; c<256 ;c++)
> fl_mapcolor(c+64, red[c], green[c], blue[c]);
> Am I on the right track with this?

That depends on the capabilities of the display. You generally have
two different sorts of Visual -- PseudoColor and TrueColor (there are
four others but they're pretty rare as far as I know -- refer to a
good Xlib text such as the O'Reilly _Xlib Programming Manual_ for
details). PseudoColor displays generally have only 256 entries in
their color lookup tables. XForms will provide some amount of color
"leakage" through substitution but the results are not always pleasing.

> Question 2: Displaying Linear Bitmaps ...
> The old application made extensive use of linear bitmaps. ...
> [...]
> How can I display an lbm (or even paint a pixel) at an arbitrary location
> within an xforms window? Would a "canvas" be the best object for
> something like this?

A linear bitmap sounds more or less like an image.

Yes, a Canvas object would probably be the easiest. Of course, you'll
have to either create your own Pixmaps or use some facility to do so.

There are no specific pixel-pushing functions in XForms.

I've been using OpenGL/MesaGL for pixel-pushing and it works pretty
well. I open a GL Canvas and then use glDrawPixels(). Saves having
to muck around with color quantization and lookup tables for the
PseudoColor mode. MesaGL does a pretty good job of dithering and
quantization for 8 bit displays.

spl
_________________________________________________
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/