Re: Grayscale visuals
- From: Owen Taylor <otaylor redhat com>
- To: Arthur Jerijian <lightmanaj earthlink net>
- Cc: gtk-list redhat com
- Subject: Re: Grayscale visuals
- Date: 03 Oct 1999 22:24:44 -0400
Arthur Jerijian <lightmanaj@earthlink.net> writes:
> Hi all,
>
> Do the mask, shift, and prec parameters (for red, green, and blue) exists in
> grayscale visuals? If not, then how can I convert back-and-forth
> between a GDK pixel and component RGB values in grayscale visuals?
The depth is the only interesting parameter for a static-gray visual
(or grayscale visual with a normal colormap) typically, converting
from the pixel value to RGB would look something like:
r = pixel << (16 - visual->depth);
g = pixel << (16 - visual->depth);
b = pixel << (16 - visual->depth);
and the reverse something like:
pixel = ((r + g + b) / 3) >> (16 - visual->depth);
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]