Converting old 8 Bit Colormap to 32 bit Colormap

Edward Slezak emslezak at yahoo.com
Fri Nov 2 09:11:17 PDT 2007


All,

I have not programmed X-Windows in some time. I have
some old code that uses an 8 bit RGB colortable. My
books do not show how to create a 32 bit colortable.
Any help would be appreciated. I just need a snippet
of code that shows what to do. My code snippet is
listed below.

   /*Create Color map*/
   xcolormap = XCreateColormap(x_display,i_rootwindow,
      x_visual, AllocAll );

   /*Black*/
   xcolors[0].red   = 0;
   xcolors[0].green = 0;
   xcolors[0].blue  = 0;

   /*Black thru blues.*/
   for (icounter=1; icounter < 20; icounter++)
      {
      xcolors[icounter].red   = 0;
      xcolors[icounter].green = 0;
      xcolors[icounter].blue  = icounter * 12;
      }

	.
	.
	.
   /*Adjust all Color flags*/
   for (icounter = 0; icounter < 100; icounter++)
      {
      xcolors[icounter].pixel = icounter;
      xcolors[icounter].flags = DoRed | DoGreen |
DoBlue;
      xcolors[icounter].red   *= 257;
      xcolors[icounter].green *= 257;
      xcolors[icounter].blue  *= 257;
      }

   XStoreColors(x_display, x_wiser_colormap, xcolors,
      100);
	.
	.

Thanks for any help
Sincerely
Ed
	

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the xorg mailing list