[winGRASS] Re: generic Windows GRASS driver
Glynn Clements
glynn.clements at virgin.net
Thu Sep 27 05:11:38 EDT 2001
Mike Thomas wrote:
> unsigned char red = (pixel & 0x00FF0000) >> 16;
> unsigned char green = (pixel & 0x0000FF00) >> 8;
> unsigned char blue = (pixel & 0x000000FF);
Ultimately this needs to use values derived from the
{red,green,blue}_mask fields from the Visual structure (the pixel
value is obtained from the RGB values using those fields), e.g.
unsigned char red = (pixel >> r_pos) << r_scale) & 0xFF;
unsigned char green = (pixel >> g_pos) << g_scale) & 0xFF;
unsigned char blue = (pixel >> b_pos) << b_scale) & 0xFF;
That would allow the code to work on 15/16 bpp displays (X also
supports 8-bpp TrueColor visuals, but I suspect that Windows doesn't).
--
Glynn Clements <glynn.clements at virgin.net>
More information about the grass-windows
mailing list