Converting text surface for faster blits

Hi.

In the application I write, there is a scrolling text running across
the screen. I know i can avoid unnecessary CPU operation during alpha
chanel blitting by converting text surface into a surface “suitable
for fast blitting onto the display surface” by using SDL_DisplayFormat.
Unfortunately, this turns the rendered text into opaque blocks. And
this is probably the correct way, since there is no information about
the background of the text.

What if I make a new surface without alpha chanel, paint it in bg
color, then blit the text on it, then convert it to “suitable” format
and use for faster blits?

Should I use SDL_CreateRGBSurface with specified width, height, 0 for
non-alpha and screen->format->Xmask for mask values?–
Maciej Grzywocz

Hello !

for fast blitting onto the display surface" by using SDL_DisplayFormat.
Unfortunately, this turns the rendered text into opaque blocks. And
this is probably the correct way, since there is no information about
the background of the text.

You may want to try SDL_DisplayFormatAlpha.

CU

Is this (“use SDL_DisplayFormatAlpha()”) in the FAQ yet? If not, it
should be. :wink: This has been asked a LOT lately.

-bill!On Thu, Oct 19, 2006 at 02:07:25PM +0200, Maciej Grzywocz wrote:

I know i can avoid unnecessary CPU operation during alpha
chanel blitting by converting text surface into a surface “suitable
for fast blitting onto the display surface” by using SDL_DisplayFormat.