nanogui: NanoGUI palette model
Subject:
Re: NanoGUI palette model
From:
"Bradley D. LaRonde" ####@####.####
Date:
30 Sep 1999 20:44:58 -0000
Message-Id: <01ff01bf0b83$afaa7b30$b8119526@ltc.com>
----- Original Message -----
From: Greg Haerr ####@####.####
To: 'Bradley D. LaRonde' ####@####.####
Cc: ####@####.####
Sent: Thursday, September 30, 1999 4:25 PM
Subject: RE: NanoGUI palette model
> : Anyway, I'm wondering: since the middle layer is flipped (BGR) to help
the
> : Microwin layer be directly compatable with Win32 ordering, that means
that
> : all non-Microwin top layers will have to a) either adopt the bogus
window
> : BGR ordering, or b) use real RGB and flip it for the middle layer. Do
you
> : think maybe it would be better to make Microwin flip so that others
don't
> : have to? I know that there really aren't "others", but if more come,
RGB
> : ordering seems more natural than BGR ordering.
> :
> : Here's another way of putting it: I think it might be more digestible
to
> : consume "Windows is backwards" than "MicroGDI is backwards" (even though
you
> : and I both know that it is all relative).
> :
> This is really a very small issue. There are countless ways
> to organize data. I just chose one way.
I know. I'm commenting on your choice. I do think it matters. Maybe there
is no technical issue, but what about the issues of understandability and
familiarity?
> BTW, it isn't backwards. Consider the structure defined in device.h:
>
> typedef struct {
> char r;
> char g;
> char b;
> };
>
> When this struct is laid down in ram (for instance in a longword)
> on a little-endian machine (all intel and mips) then the byte order you
get is
> exactly the order that you think is backwards. This allows the palette
> entries (RGB values) to be read using an old-fashioned (nonportable) C
trick without
> calling a function:
> rgbval = (*(unsigned long *)&rgbentry) & 0xFFFFFF;
I saw that struct. That's what throws things off. Why even define a struct
of three chars?
The thing is, what is a COLORVAL? It is an unsigned long (ul32 might be
better put), but is it 0x00rrggbb or 0x00bbggrr? I'm more comfortable with
and would probably assume the first (i.e. HTML does it #rrggbb).
By declaring the struct, you make endianness an issue. I don't think it
needs to be.
Regards,
Brad