nanogui: how to set the CMAP fot frame buffer?


Previous by date: 24 Jun 1999 17:01:18 -0000 CVS, Alex Holden
Next by date: 24 Jun 1999 17:01:18 -0000 Re: nano-X 0.6, Greg Haerr
Previous in thread: 24 Jun 1999 17:01:18 -0000 Re: how to set the CMAP fot frame buffer?, Cheng Bor-wen
Next in thread: 24 Jun 1999 17:01:18 -0000 Re: how to set the CMAP fot frame buffer?, Cheng Bor-wen

Subject: RE: how to set the CMAP fot frame buffer?
From: Greg Haerr ####@####.####
Date: 24 Jun 1999 17:01:18 -0000
Message-Id: <01BEBE30.600DD720.greg@censoft.com>

Try this



/* Set NC color palettes values starting at C to red-green-blue value
   specified in PALETTE.  Use 8-bit color values as input. */
void
bogl_set_palette (int c, int nc, const unsigned char (*palette)[3])
{
  struct fb_cmap cmap;

  __u16 red[nc];
  __u16 green[nc];
  __u16 blue[nc];

  int i;

  for (i = 0; i < nc; i++)
    {
      const unsigned char *e = palette[i];
      
      if (gray)
	red[i] = green[i] = blue[i] = (e[0] * 77 + e[1] * 151 + e[2] * 28);
      else
	{
	  red[i] = e[0] << 8;
	  green[i] = e[1] << 8;
	  blue[i] = e[2] << 8;
	}
    }

  cmap.start = c;
  cmap.len = nc;
  cmap.red = red;
  cmap.green = green;
  cmap.blue = blue;
  cmap.transp = NULL;

  if(ioctl (fb, FBIOPUTCMAP, &cmap) == -1)
	  printf("putcmap fail\n");
}


Previous by date: 24 Jun 1999 17:01:18 -0000 CVS, Alex Holden
Next by date: 24 Jun 1999 17:01:18 -0000 Re: nano-X 0.6, Greg Haerr
Previous in thread: 24 Jun 1999 17:01:18 -0000 Re: how to set the CMAP fot frame buffer?, Cheng Bor-wen
Next in thread: 24 Jun 1999 17:01:18 -0000 Re: how to set the CMAP fot frame buffer?, Cheng Bor-wen


Powered by ezmlm-browse 0.20.