XDRIVER

I have written X11 code that will run a 24-bit X display in GRASS3.0
but can't seem to find it right now. ( Don't tell my boss.)

There are a couple of inefficient ways to do it: This is one of them!

  ( From the 3.0 XDRIVER source )

  1. In Graph_Set.c change the line:

   bkupmap = XCreatePixmap(dpy,grwin,SC_WID,SC_HITE,8);
     to
   bkupmap = XCreatePixmap(dpy,grwin,SC_WID,SC_HITE,24);

  2. In Reset_clr.c add the lines:

   (globally )
   int Red[NCOLORS],Grn[NCOLORS],Blu[NCOLORS];

   ( in the function )
    Red[number] = red;
    Grn[number] = grn;
    Blu[number] = blu;

  3. In Color.c add the line:

   (globally)
   extern int Red[NCOLORS],Grn[NCOLORS],Blu[NCOLORS];

     and then change the line in the function:

   XSetForeground(dpy,gc, (unsigned long) number);

     to

   int shftcolr;
   shiftcolr = (Red[number] << 16) | (Grn[number] << 8) | Blu[number];
        XSetForeground(dpy,gc, (unsigned long) shiftcolr);

  Explanation:
    1. Set the backup pixmap to the same depth as your main window. I think
  the GRASS4.0 driver correctly uses window manager hints. So if you are
  modifying 4.0 skip #1.
    2. In Reset_clr.c when the RGB values are passed in, save them in a
  three global color tables to be retrieved later by Color.c.
    3. In Color.c using the color number from the input parameters, use
  the color lookup values, bit shift them up for the display device.
  Generally after Color.c has been called, a line, or polygon will be
  drawn with the set Foreground color.

  ** Warning **
    The XSetForeground call in Color.c, will slow down display speed with
  excessive network i/o. Perhaps someone with some time could write an
  efficient XDRIVER for 24-bits, but until then, this should get you
  going in the right direction.

    I wonder if there should be a disclaimer to this message?

  Jerry Ballard
  Spatial Data Systems Team
  Waterways Experiment Station
  United States Army Corp Engineers

+----------------------------+---------------------------------------+
| USACE-WES-EN-A | FAX: (601) 634-3842 |
| ATTN: Jerry Ballard, EN-A | Voice: (601) 634-2946 |
| 3909 Halls Ferry Rd. | e-mail: ballard@mc1.wes.army.mil |
| Vicksburg, MS 39180 | |
+----------------------------+---------------------------------------+