[SDL] RGBA->RGBA blitting again

Gabriel Gambetta ggambett at artech.com.uy
Thu Nov 27 05:36:01 PST 2003


> I'm writing a small font library that prints text to a 
> transparent overlay, which is then displayed on the screen 
> when a key is held down. The code works fine as long as the 
> font is stored in a colorkeyed surface, but when I copy it 
> to an RGBA surface with SDL_DisplayFormatAlpha for faster 
> blitting, the text itself becomes transparent. I searched 
> the archives, and I guess this is an old problem, but this 
> limits me to slow blits with 1-bit alpha and no anti-aliased 
> fonts. You can see my test code here:

I had to write a custom blitter and use dst_alpha = max (dst_alpha,
src_alpha)

It's ugly but it worked at least where I wanted it to work :) It was
with
fonts, too.

Lic. Gabriel Gambetta
ARTech - GeneXus Development Team
ggambett at artech.com.uy


-----Original Message-----
From: MagerValp [mailto:MagerValp at cling.gu.se] 
Sent: Jueves, 27 de Noviembre de 2003 09:31 a.m.
To: sdl at libsdl.org
Subject: [SDL] RGBA->RGBA blitting again


I'm writing a small font library that prints text to a transparent
overlay, which is then displayed on the screen when a key is held down.
The code works fine as long as the font is stored in a colorkeyed
surface, but when I copy it to an RGBA surface with
SDL_DisplayFormatAlpha for faster blitting, the text itself becomes
transparent. I searched the archives, and I guess this is an old
problem, but this limits me to slow blits with 1-bit alpha and no
anti-aliased fonts. You can see my test code here:

  http://www.cling.gu.se/~cl3polof/testalpha.c
  http://www.cling.gu.se/~cl3polof/10x12yellow.bmp

Is there a workaround for this?

-- 
    ___          .     .  .         .       . +  .         .      o   
  _|___|_   +   .  +     .     +         .  Per Olofsson, arkadspelare
    o-o    .      .     .   o         +          MagerValp at cling.gu.se
     -       +            +    .     http://www.cling.gu.se/~cl3polof/

_______________________________________________
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl




More information about the SDL mailing list