Ok, after testing on my Windows PC, the small endian version seems correct, but I am not sure what the big endian code would look like, and I can't test it anyway...
if someone could workout some code and maybe test it on their big endian machine (if possible) that would be great
Below is the routine that would use the calculated masks.
Code:
Function CreateSurface(Const AWidth,AHeight : Word;
Const ABitDepth : TBitDepth) : PSDL_Surface;
Var
bpp : Byte;
RMask : LongWord;
GMask : LongWord;
BMask : LongWord;
AMask : LongWord;
Begin
Case ABitDepth Of
eBitDepth_8Bit : bpp := 8;
eBitDepth_15Bit : bpp := 15;
eBitDepth_16Bit : bpp := 16;
eBitDepth_24Bit : bpp := 24;
eBitDepth_32Bit : bpp := 32;
Else
bpp := 16;
End;
CalculateRGBAMasks(ABitDepth,RMask,GMask,BMask,AMask);
Result := SDL_CreateRGBSurface(SDL_SWSURFACE,
AWidth,
AHeight,
bpp,
RMask,
GMask,
BMask,
AMask);
FillChar(PByte(Result^.pixels)^,AWidth * AHeight * Result^.format^.BytesPerPixel,0);
End;
cheers,
Paul
Bookmarks