Flipped alpha and some common mistakes

Finally, the alpha flip patch has been committed to CVS. Most SDL programs
will not be affected, but some might have to be updated. Here are some
things to look out for:

  • Direct manipulation of the alpha channel: zero alpha is now transparent,
    and full alpha (255 with 8 bit alpha channel) is opaque.

  • Per-surface alpha set with SDL_SetAlpha() must be inverted in the same
    way.

  • SDL_MapRGB() returns opaque pixels. Example: On a 32-bit ARGB8888
    surface, MapRGB(format, 0x11, 0x22, 0x33) returns 0xff112233. If this
    isn’t what you want, mask away the alpha value of the pixel.
    You can also use the new SDL_MapRGBA() function to explicit specify the
    alpha value.

  • You need a new SDL_image version ( > 1.0.9) to load images with alpha
    channel properly; it will be released shortly. IMG_InvertAlpha()
    has no effect: all images are loaded with the new alpha sense.

  • The SDL_SRCALPHA flag set on a surface now means that blits from that
    surface are alpha-blended onto the destination. If the source surface
    has an alpha channel then that is used, otherwise the per-surface
    alpha values is used. Use SDL_SetAlpha() to set or clear the SDL_SRCALPHA
    flag on a surface. If SDL_SRCALPHA is not set, blits will just do
    a copy.

As always the WhatsNew file contains a list of all user-visible changes.
Please complain if something is missing.