Alpha channel - was Re: [SDL] Truetype vs bitmapped fonts? Opinions?

William Kendrick nbs at
Tue Apr 11 21:39:57 PDT 2000

> This is just what the SDL_bmf library does
> (for bitmapped characters, not ttf), except the
> part about alpha values. Can someone explain 
> (maybe in a private email) what is the purpose
> of alpha channels, or point me at relevant
> documentation?

Alpha channels allow pixels to be blended together.  For a good example,
try playing with a paint program like PhotoShop or GIMP.  Set up two layers,
one with a picture, and another with text...

Then start fiddling with the transparency of the text layer... you'll see
what happens when alpha values get changed :)   (the text fades in and out
of opacity)

> I gather it has to do with
> transparency, but I'm really fuzzy beyond that.

Exactly.  Well, imagine unantialised text.  (That is, text which is drawn
in just color or no-color...  let's say black and white, since it's

Take the letter O:

 #   #
#     #
#     #
#     #
 #   #

Notice how it looks kind of stair-steppy? Jagged?  Well, if you antialias,
using 'in-between' colors (ie, grey), it looks smoother:

+#   #+
#+   +#
#     #
#+   +#
+#   #+

(ok, my ASCII drawing sucks, but still... you get the picture, hopefully)

Ok, so say we had a font with black text that's antialised to white (ie,
the in-between colors are grey).  It'll look great on a white background!

Now... the problem here is when you try to draw it on, say, a medium-blue
background.  Now you have weird grey edges... it would've been better to
just not antialias it in the first place. <:^(

This is where the alpha channel comes in.  Instead of saying "grey",
we just say "black with 50% transparency", for example.

Now, when we draw this black alpha-channel-enabled text on a white background,
the antialias pixels will be grey. It'll look great!

And when we draw it on a medium-blue background, the antialiased pixels
will be dark blue.  It'll still look great!

In other words, alpha channels let you antialias your images without
being concerned as to what background they'll be on..

I'm a bit distracted by Mad Max: Beyond Thunderdome on TV, so I'm sure this
isn't the best explanation... but, there are no doubt tons of better
descriptions on graphics- and game-related websites and in books!

Take care!


More information about the SDL mailing list