Hi
Sorry, I have no access to a big endian machine for now, only PCs, so that’s
why I ask here.
When SDL is running on a big endian machine, at 24bpp & 32bpp, do the
surfaces return the masks as if each pixel was accessed through a 32 bit
pointer, or does it only help for ordering the RGB triplet?
So, if I do
Uint32 temp,mask;
unsigned char r,g,b;
unsigned char *p;
SDL_PixelFormat *fmt = surface->format;
...
p = surface->pixels + ...
mask = fmt->Rmask | fmt->Gmask | fmt->Bmask;
temp = (((Uint32)(r>>fmt->Rloss))<<fmt->Rshift)&fmt->Rmask;
temp |= (((Uint32)(g>>fmt->Gloss))<<fmt->Gshift)&fmt->Gmask;
temp |= (((Uint32)(b>>fmt->Bloss))<<fmt->Bshift)&fmt->Bmask;
p = (p & ~mask) | (temp & mask);
Will the RGB bytes be always in the three lowest bytes (so I need to shift
left if the machine is big endian)? or will they be already in the right
position always?
Thanks
Drirr C.