On Wed, 23 Oct 2002, Kunxiu Gao wrote:

> Hi,
> 
> I currently have XFree86 4.1.0 on the redhat 7.2 machine.  I am trying to
> program for the 16bit color display, but I just could not get the color
> right.  I already have the correct display for 8bit and 24bit on this
> machine.  Some help is needed and will be appreciated.
> 
> Since the display is 16bit, according to the result of xdpyinfo (see below),
> the masks for r,g,b are 0xf800, 0x7e0, 0x1f.  Does it mean the following
> formula should generate the correct entry for a color with r, g, b value
> red, green and blue?
>               red && 0xf800 + green && 0x7e0 + blue && 0x1f

I think you want:
  ((red << 11) && 0xf800) + ((green << 5) && 0x7e0) + (blue && 0x1f)

-- 
Dr. Andrew C. Aitchison         Computer Officer, DPMMS, Cambridge
[EMAIL PROTECTED]   http://www.dpmms.cam.ac.uk/~werdna

_______________________________________________
Xpert mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/xpert

Reply via email to