Re: XForms: Palette & Linear Bitmap questions

Joe Albowicz (
Fri, 15 Aug 1997 08:35:48 -0700 (PDT)

To subscribers of the xforms list from Joe Albowicz <> :

Hi there,

Can't help with Q1, but as to Q2 the following calls will allow you to
draw a pixel.

fl_rectf(x,y,w,h,color); // w = h = 1 makes a pixel

Or the Xlib calls (slightly faster) are:

XSetForeground(modelui->display, gc, fl_get_pixel(color));

Joe Albowicz

On Fri, 15 Aug 1997 wrote:

> To subscribers of the xforms list from :
> My apologies if you've seen this message before: my previous two attempts
> to send it (apparently) disappeared into the void and left no mark on the
> mailing list archives.
> My further apologies if these questions are blindingly obvious faqs. I'm
> somewhat new to X-windows programming: please point me toward the
> appropriate documents.
> Ok, so I've installed xforms 0.86, built the demos, built "hello world"
> type programs, used fdesign and everything works fine. Now I'm trying to
> port an old svgalib (256-color) application to xforms (under linux/x86).
> 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?
> Question 2: Displaying Linear Bitmaps ...
> The old application made extensive use of linear bitmaps. Briefly, a
> linear bitmap is a two-dimensional array (of externally known height and
> width) where each element represents a pixel colors for a picture. In
> 8-bit mode a 12x10 lbm would be 120 bytes long and the first 12 would hold
> the colors for the pixels in the top row, etc. Thus, if you were forced
> to display on one the screen by hand you might code something like this:
> unsighed char lbm[120]; /* our linear bitmap */
> for (y=0; y<10 ;y++)
> for (x=0; x<12 ;x++)
> set_pixel_color(x+x_offset,y+y_offset,/ *color = */ lbm[(y*12)+x]);
> 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?
> If push truly comes to shove, I could convert all of the lbms to xpms
> (dramatically increasing their size, though): if there is no way to draw
> arbitrary points to an xforms window, is there a way to draw arbitrary
> xpms (outside of the pixmapbutton)? I would much prefer to use them as
> lbms, however: I don't know the xpm format as well.
> Thanks!
> -Wes Weimer
> _________________________________________________
> To unsubscribe, send the message "unsubscribe" to
> or see
> Xforms Home Page:
> List Archive:

To unsubscribe, send the message "unsubscribe" to or see
Xforms Home Page:
List Archive: