Barry wrote:
> "Vladimir S. Oka" <> wrote in message
> news: oups.com...
> > RSoIsCaIrLiIoA wrote:
> > > On Fri, 27 Jan 2006 21:13:12 +0000 (UTC), "Malcolm"
> > > <> wrote:
> > > >An image is basically this
> > > >
> > > >struct colour
> > > >{
> > > > unsigned char red;
> > > > unsigned char green;
> > > > unsigned char blue;
> > > >};
> > > >
> > > >struct image
> > > >{
> > > > int width;
> > > > int height;
> > > > struct colour *pixels;
> > > >}
> > >
> > > why not this?
> > >
> > > struct color{
> > > unsigned char red;
> > > unsigned char green;
> > > unsigned char blue;
> > > };
> > >
> > > struct image
> > > {struct color pixel[1024][768];};
> >
> > Because 1024x768 is not the only resolution allowed by laws of physics!
> >
> > Malcolm's code would work on my digital watch with 53x231 screen, and
> > only 16K of RAM, yours probably wouldn't even link (at least not
> > without serious warnings).
> >
> > Cheers
> >
> > Vladimir
> >
>
> But Malcolm's code may or may not work on MS Windows, depending on
> how the graphics side is treated.
And why wouldn't it? Malcom just stated that images, in principle, can
be represented as above, and in standard C. There was no discussion on
how such an image would be displayed (if at all). The method of
displaying could certainly include casting to system-defined types.
My comment was meant to highlight better portability of Malcolm's
example.
OP's question, whilst off topic, was about representing colors using
RGB values, not displaying them on any given device/system. Admittedly,
OP muddied the waters by listing a few specific implementations.
Pixels certainly can be represented as below as well, but /not/ in
standard C, so that'd be even more off-topic.
> Windows likes to use:
>
> struct color {
> BYTE blue;
> BYTE green;
> BYTE red;
> };
>
> Thus another reason why such discussions don't belong on clc.
I do agree that the OP's original question was quite off topic.
Cheers
Vladimir