Re: [gtk-list] Re: how to convert windows RGB color to GdkColor
- From: Tomi Ollila <Tomi Ollila tfi net>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: how to convert windows RGB color to GdkColor
- Date: Wed, 1 Sep 1999 09:41:10 +0300 (EET DST)
Tuesday Aug 31 22:44:24 -0600 1999 Joe Pfeiffer <pfeiffer@cs.nmsu.edu> wrote:
> 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.
Why it doesnt ? :
old color new color
dec hex dec hex
0 00 0 0000
1 01 257 0101
2 02 514 0202
...
63 3f 16191 3f3f
...
254 fe 65278 fefe
255 ff 65535 ffff
>
> Go Lobos!
> Joseph J. Pfeiffer, Jr., Ph.D. Phone -- (505) 646-1605
Tomi
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]