[SDL] Pixel byte manipulation question.

Paul Duffy odubtaig at yahoo.co.uk
Tue Oct 2 08:45:04 PDT 2007


> the mask tell you what part of the uint32 is RGBA.  it is not the
> same on all machines, it is determined by the graphics hardwhere.  i
> test my app on 3 different machines and each have a different RGBA
> mask.

That's not the part I'm wondering about, I know the mask /order/ is
different for different computers (and actually different file formats
on load) and that at some point the bytes have to be ordered in a way
the hardware expects.

What I need to know is, can I expect the mask and colorkey data be in
the rightmost portion of a Uint32 _regardless_of_platform_? I know the
order could be RGBA/BGRA/ARGB/ABGR or 565/3553/RGB/BGR. However, some
of the data is stored with bitshifting which doesn't give a monkeys
about Endianness and just puts the bits in a specific position, eg. the
rightmost bit, whether that's the highest, lowest or middling bit which
means that regardless of the ordering, some data will end up in the
same bytes of a Uint32 no matter what platform is being used.

So, if a 24 but value is being stored, is it stored in the first or
last 24 bits of the 32 bit integer? If it's 16 bits, is it stored in
the higher or lower half? Is an 8 bit palette value stored in the first
or last byte of the (still) 32 bit colorkey?

Really, it's not a question of hardware, it's a question of how SDL
handles data internally and whether this is consistent.


       
____________________________________________________________________________________
Be a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=list&sid=396545469


More information about the SDL mailing list