[SDL] new alpha blit semantics
f91-men at nada.kth.se
Thu Aug 10 08:40:20 PDT 2000
>What do you folks think of allowing 8-bit palettized surfaces to have
>alpha in the palette colors?
There are lots of tricks you can do with 8-bit surfaces and lookup tables;
SDL can only cover the very basics. The one you describe is interesting
and occasionally useful (and both TGA and PNG support per-index alpha values
for colormapped images).
>One example of this feature being useful would be so that nice font
>libraries like FreeType 2 modified SDL_ttf could store 8-bit surfaces
>for each character, and change the palette to change colors, instead of
>allocating a 32-bit RGBA surface and having to render from 8-bit to RGBA
>manually every time.
Last time I had to do this I rendered the font in 8-bit greyscale (where
0 = transparent, 255 = opaque, essentially just rendering the alpha
channel of the glyphs) and then used a look-up table for each colour.
No doubt SDL_ttf can be persuaded to do this.
Anyway, since it isn't hard to write platform-independent code that does
this in the application that needs it (or maybe in a library like SDL_ttf),
I don't think it's necessary to put it into SDL, unless someone
bribes^Wpersuades me otherwise :-)
More information about the SDL