This has some information on alpha blending with SDL 1.2:
http://code.bluedinosaurs.com/tutorials/blending.html
It doesn’t consider endianess, but that’s just:
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
SDL_Surface* result =
SDL_CreateRGBSurface(flags,width,height,32, 0xFF000000, 0x00FF0000,
0x0000FF00, 0x000000FF);
#else
SDL_Surface* result =
SDL_CreateRGBSurface(flags,width,height,32, 0x000000FF, 0x0000FF00,
0x00FF0000, 0xFF000000);
#endif
SDL_SetAlpha(result, SDL_SRCALPHA, SDL_ALPHA_OPAQUE);
The pixels member works just the same, but you should be aware of the
order of the bytes.
Jonny DOn Mon, Jul 13, 2009 at 8:55 PM, Nate Fries wrote:
Well, I was originally using 24-bit graphics for a project of mine, but
recently some people have been hounding me to add opacity support.
I can’t find any reference on creating an RGBA texture anywhere, and
SDL_video.h doesn’t have a SDL_CreateRGBASurface function defined.
How would I go about creating a 32-bit (RGBA) surface? Would its pixels
member act exactly the same as with an RGB texture, but with the additional
alpha channel byte?
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org