Re: [gtk-list] Re: how to convert windows RGB color to GdkColor



   Right-shifting to convert from 16bpp to 8bpp works fine:

	   0xFFFF (full-bright) becomes 0xFF (full-bright).

   But left-shifting doesn't:

	   0xFF (full-bright) becomes 0xFF00 (less-than-full-bright).

   Adding in the old value is a fast way to scale the values properly, so 0xFF
   becomes 0xFFFF.  You can multiply by 257.0 if you prefer :)

This is true of the special case of
1) old value was ff, and
2) you really meant full-bright, that didn't just happen to be what
you got.

(and the analogous 0x00 case).  It doesn't follow in general, though.

   Go Lobos!

(loud Bronx cheer)
-- 
Joseph J. Pfeiffer, Jr., Ph.D.       Phone -- (505) 646-1605
Department of Computer Science       FAX   -- (505) 646-1002
New Mexico State University          http://www.cs.nmsu.edu/~pfeiffer



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]